#include <stdio.h>
#include <string.h>

int digit_count[20];

int main() {
  int k;

  scanf("%d", &k);
  while (k--) {
    int n, i, num, digit;

    scanf("%d", &n);
    memset(digit_count, 0, sizeof(digit_count));
    for (i = 1; i <= n; i++) {
      num = i;
      while (num) {
        digit = num % 10;
        num /= 10;
        digit_count[digit]++;
      }
    }

    for (i = 0; i < 9; i++) {
      printf("%d ", digit_count[i]);
    }
    printf("%d\n", digit_count[9]);
  }

  return 0;
}
